import { createWebHistory, createRouter } from 'vue-router'
// 公共路由
export const constantRoutes = [
  // {
  //   path: '/redirect',
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: '/redirect/:path(.*)',
  //       component: () => import('@/views/redirect/index.vue')
  //     }
  //   ]
  // },
  {
    path: '/login',
    component: () => import('@/views/login.vue'),
  },
  {
    path: '/register',
    component: () => import('@/views/register.vue'),
  },
  {
    path: '/music',
    component: () => import('@/components/music/views/index/index.vue'),
  },
  {
    path: '/original',
    component: () => import('@/views/original/indexBak.vue'),
  },
  {
    path: '/mv',
    component: () => import('@/views/mv/index.vue'),
  },
  {
    path: '/upload',
    component: () => import('@/components/music-content/upload.vue'),
  },
  {
    path: '/myMusic',
    component: () => import('@/components/music-content/myMusic.vue'),
  },
  {
    path: '/userAdmin',
    component: () => import('@/components/music-content/userAdmin.vue'),
  },
  {
    path: '/comments',
    component: () => import('@/components/music-content/comments.vue'),
  },
  // {
  //   path: '/rank',
  //   component: () => import('@/components/music-content/rank.vue'),
  // },
  {
    path: '/rankInfo',
    component: () => import('@/components/music-content/rankInfo.vue'),
  },
  {
    path: '/rank', name: 'rank',
    component: () => import('@/components/music-content/rankInfo.vue')
  },
  {
    path: '/song', name: 'song',
    component: () => import('@/components/music/views/song/Index.vue')
  },
  {
    path: '/singer', name: 'singer',
    component: () => import('@/components/music/views/singer/Index.vue')
  },
  {
    path: '/singer/detail', name: 'singerdetail',
    component: () => import('@/components/music/views/singer/Detail.vue')
  },
  {
    path: '/playlist', name: 'playlist',
    component: () => import('@/components/music/views/playlist/Index.vue')
  },
  {
    path: '/playlist/detail', name: 'playlistdetail',
    component: () => import('@/components/music/views/playlist/Detail.vue')
  },
  {
    path: '/artist', name: 'artist', component: () => import('@/components/music/views/artist/Index.vue')
  },
  {
    path: '/information', name: 'information', component: () => import('@/components/music-content/information.vue')
  },
  {
    path: '/article/detail/:id', name: 'articleDetail', component: () => import('@/views/article/detail/index.vue')
  },
  {
    path:'/articleAdmin',name: 'articleAdmin',component: () => import('@/views/article/detail/articleAdmin.vue')
  },
  {
    path: '/',
    redirect: '/music',
  },
  {
    path: '/search/:id', name: 'searchDetail',
    component: () => import('@/components/music-content/search.vue')
  },
  {
    path: '/search', name: 'search',
    component: () => import('@/views/search/Index.vue')
  },

  {
    path: '/album', name: 'album',
    component: () => import('@/components/music/views/album/Index.vue')
  },

  {
    path: '/steps', name: 'steps',
    component: () => import('@/components/music-content/steps.vue')
  },
  
  {
    path: '/ECharts', name: 'ECharts',
    component: () => import('@/components/music-content/ECharts.vue')
  },
  {
    path: '/userRoot', name: 'userRoot',
    component: () => import('@/views/userRoot/index.vue')
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes: constantRoutes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { top: 0 }
    }
  },
});

export default router;
